package org.example

import org.junit.jupiter.api.Test


class Tests {
    @Test
    fun test1(): Unit {
        println(greet())
    }

    @Test
    fun test2(): Unit {
        println(greet("Leil"))
    }


    @Test
    fun testMax() {
        val numbers = intArrayOf(18, 29, 3, 46, 57, 6334, 7543, 86, 954, 10)
        println("max val in numbers is ${max( numbers)}")
    }


}


// KISS(Keep it simple, stupid)函数
fun greet() = "Hello Kotlin KISS"

fun greet(name: String) = "Hello $name"

fun greet(name1: String, name2: String) {
    //    name1 = "Leil" 这行代码编译错误，因为入参默认是val
    // 而且Kotlin的入参不允许被修饰成var
}

fun max(numbers: IntArray): Int {
    var max = Int.MIN_VALUE
    for (number in numbers) {
        max = if (number > max) number else max
    }
    return max
}